package com.sqf.soft.controller;

import com.sqf.soft.entity.Classify;
import com.sqf.soft.service.IClassifyService;
import com.sqf.soft.utils.PageBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("classify")
public class ClassifyController {

    private IClassifyService classifyService;

    @Autowired
    public ClassifyController(IClassifyService classifyService) {
        this.classifyService = classifyService;
    }

    @RequestMapping("findClassifyAll")
    public Map<String, Object> findClassifyAll() {
        return classifyService.findClassifyAll();
    }

    @RequestMapping("findClassifyTree")
    public Map<String, Object> findClassifyTree() {
        return classifyService.findClassifyTree();
    }

    @RequestMapping("findClassifyByPage")
    public Map<String, Object> findClassifyByPage(@RequestBody PageBean pageBean) {
        return classifyService.findClassifyByPage(pageBean);
    }

    @RequestMapping("createClassify")
    public Map<String, Object> createClassify(@RequestBody Classify classify) {
        return classifyService.createClassify(classify);
    }

    @RequestMapping("updateClassify")
    public Map<String, Object> updateClassify(@RequestBody Classify classify) {
        return classifyService.updateClassify(classify);
    }

    @RequestMapping("deleteClassify")
    public Map<String, Object> deleteClassify(@RequestBody Classify classify) {
        return classifyService.deleteClassify(classify);
    }
}
